<?php require("../common/pdata_mysql.php"); ?>
<?php require("../common/function.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>项目列表</title>
<style type="text/css">
.list {
	width: 99%;
	font-size: 12px;
}
</style>
<link href="/css/allstyle.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="header">
  <?php include("../common/header.php") ?>
</div>
<div id="wrap">
  <?php 
        $sql = "select itemid,iname,pid,ptid,phid,frm,stid,procode from itemdetail order by pid,itemid";
        $conn = mysql_pconnect($hostname_pdata,$username_pdata,$password_pdata);
        mysql_select_db("pdata");
        $rs = mysql_query($sql,$conn) or die(mysql_error());
        echo "<p>项目 ".mysql_num_rows($rs)." 个</p>";
?>
  <table border="1" class="list">
    <tr>
      <th>代码</th>
      <th>项目名称</th>
      <th>项目类型</th>
      <th>项目阶段</th>
      <th>来源</th>
      <th>P代码</th>
      <th>编辑</th>
    </tr>
    <?php 
        while($row = mysql_fetch_array($rs))
        {
                echo "<form method='get' action='item_view.php' target='_new'><tr>";
                echo "<td>".$row['itemid']."</td>";
                echo "<td>".$row['iname']."</td>";
                echo "<td>".getype($row['ptid'])."</td>";
                echo "<td>".getphase($row['phid'])."</td>";
                echo "<td>".$row['frm']."</td>";
                echo "<td>".$row['pid']."</td>";
                echo "<td align='center'><input type='submit' name='itemid' value='".$row['itemid']."' /></td>";
                echo "</tr></form>";
        }
        mysql_close($conn);

?>
  </table>
</div>
<div id="footer">
  <?php include("../common/footer.php") ?>
</div>
</body>
</html>